package com.boarsoft.boar.office.tech;

import org.springframework.beans.factory.annotation.Autowired;

import com.boarsoft.boar.office.Constants;
import com.boarsoft.boar.office.entity.MeetingInfo;
import com.boarsoft.boar.office.entity.OfficeWorkInfo;
import com.boarsoft.boar.office.meeting.MeetingBiz;
import com.boarsoft.common.Util;
import com.boarsoft.flow.core.bean.ProcessHandler;

public class NewTechAuditPH implements ProcessHandler {
	@Autowired
	protected MeetingBiz meetingBiz;

	@Override
	public Object process(String entry, Object data, Throwable throwable) throws Throwable {
		// 当前任务为：业务设计子任务
		OfficeWorkInfo a = (OfficeWorkInfo) data;
		// 创建业务设计评审会议
		MeetingInfo m = new MeetingInfo();
		m.setOwnerId(a.getOwnerId());
		m.setWorkId(a.getId());
		m.setPriority(a.getPriority());
		m.setTitle(a.getTitle().concat("-评审"));
		m.setStartTime(Util.getStdfDateTime());
		m.setEndTime(Util.getStdfDateTime());
		m.setType(Constants.MEETING_TYPE_BIZAUDIT2);
		if (Util.strIsEmpty(a.getFlowId2())) {
			m.setFlowId(a.getFlowId());
			m.setFlowExeId(a.getFlowExeId());
		} else {
			m.setFlowId(a.getFlowId2());
			m.setFlowExeId(a.getFlowExeId2());
		}
		meetingBiz.save(m);
		return m;
	}
}